package com.hp.attendance.serlvet.history.InService;

import com.hp.attendance.service.EmployeeBysService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/delEmployee")
public class EmployeeDelServlet extends HttpServlet {
    private EmployeeBysService employeeBysService = new EmployeeBysService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {

            String employee_number = req.getParameter("employee_number");
            employeeBysService.DelEmployee(Integer.parseInt(employee_number));
            req.getRequestDispatcher("EmployeeList").forward(req,resp);


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
